from dataclasses import dataclass, Field
import os
from dotenv import load_dotenv, find_dotenv
from typing import List

@dataclass
class Settings:
    # 加载环境变量
    load_dotenv(find_dotenv(), override=True)
    # 调试模式
    APP_DEBUG: bool = True
    SWAGGER_UI_OAUTH2_REDIRECT_URL = "/api/v1/user/login"
    # 项目信息
    VERSION: str = "0.0.3"
    PROJECT_NAME: str = "zhupu"
    # 静态资源目录
    BASE_DIR = os.path.dirname(__file__)
    # 跨域请求
    CORS_ORIGINS = ["*"]
    CORS_ALLOW_CREDENTIALS: bool = True
    CORS_ALLOW_METHODS = ["*"]
    CORS_ALLOW_HEADERS = ["*"]
    # Session
    SECRET_KEY = "session"
    SESSION_COOKIE = "session_id"
    SESSION_MAX_AGE = 14 * 24 * 60 * 60
    # Jwt
    JWT_SECRET_KEY = "09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7"
    JWT_ALGORITHM = "HS256"
    JWT_ACCESS_TOKEN_EXPIRE_MINUTES = 24 * 60
    # 静态文件设置
    STATIC_URL = "/static"  # 静态文件URL前缀
    STATIC_ROOT = os.path.join(BASE_DIR, "static")  # 静态文件根目录


settings = Settings()
